package com.ruoyi.project.system.controller;

import java.util.List;

import com.ruoyi.project.system.domain.SysGoodsImg;
import com.ruoyi.project.system.service.ISysGoodsImgService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysGoodsComment;
import com.ruoyi.project.system.service.ISysGoodsCommentService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;

/**
 * 二手物品评论Controller
 * 
 * @author jjp
 * @date 2020-04-21
 */
@RestController
@RequestMapping("/system/goodscomment/")
public class SysGoodsCommentController extends BaseController
{
    @Autowired
    private ISysGoodsCommentService sysGoodsCommentService;

    /**
     * 查询二手物品评论列表
     */
    @PreAuthorize("@ss.hasPermi('system:goodscomment:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysGoodsComment sysGoodsComment)
    {
        startPage();
        List<SysGoodsComment> list = sysGoodsCommentService.selectSysGoodsCommentLists(sysGoodsComment);
        return getDataTable(list);
    }

    /**
     * 获取二手物品评论详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:goodscomment:query')")
    @GetMapping(value = "/{commentId}")
    public AjaxResult getInfo(@PathVariable("commentId") Long commentId)
    {
        return AjaxResult.success(sysGoodsCommentService.selectSysGoodsCommentById(commentId));
    }

    /**
     * 修改二手物品评论
     */
    @PreAuthorize("@ss.hasPermi('system:goodscomment:edit')")
    @Log(title = "二手物品评论", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysGoodsComment sysGoodsComment)
    {
        return toAjax(sysGoodsCommentService.updateSysGoodsComment(sysGoodsComment));
    }

    /**
     * 删除二手物品评论
     */
    @PreAuthorize("@ss.hasPermi('system:goodscomment:remove')")
    @Log(title = "二手物品评论", businessType = BusinessType.DELETE)
	@DeleteMapping("/{commentIds}")
    public AjaxResult remove(@PathVariable Long[] commentIds)
    {
        return toAjax(sysGoodsCommentService.deleteSysGoodsCommentByIds(commentIds));
    }
}
